package ctd.util.xml.jaxb;

import ctd.util.converter.DateConverter;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.util.Date;

/**
 * Date适配器
 * @author zhengz
 * @date 16/01/07
 */

public class DateAdapter extends XmlAdapter<String, Date> {

    @Override
    public Date unmarshal(String dateStr) throws Exception {

        return DateConverter.StringToDate(dateStr);
    }

    @Override
    public String marshal(Date date) throws Exception {

        return DateConverter.DateToString(date);
    }
}
